﻿@{
    ViewBag.Title = "Administrator";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>

 <link rel="stylesheet" href="~/jqwidgets/styles/jqx.base.css" type="text/css" />

    <script type="text/javascript" src="~/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxdata.js"></script> 
    <script type="text/javascript" src="~/jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxcheckbox.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxgrid.sort.js"></script> 
    <script type="text/javascript" src="~/jqwidgets/jqxgrid.pager.js"></script> 
    <script type="text/javascript" src="~/jqwidgets/jqxgrid.selection.js"></script> 
    <script type="text/javascript" src="~/jqwidgets/jqxgrid.edit.js"></script>
<script src="~/jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var url = "@Url.Action("jsonList")";
            // prepare the data
            var source =
            {
                datatype: "json",
                datafields: [
                    { name: 'cAccName', type: 'string' },
                      { name: 'dLoginDate', type: 'date' },
                        { name: 'dLogoutDate', type: 'date' },
                  //dLoginDate
                    { name: 'nExtPoint', type: 'string' },
                       { name: 'nExtPoint1', type: 'string' },
                          { name: 'nExtPoint2', type: 'string' },
                             { name: 'nExtPoint3', type: 'string' },
                                { name: 'nExtPoint4', type: 'string' },
                                   { name: 'nExtPoint5', type: 'string' },
                                      { name: 'nExtPoint6', type: 'string' },
                                         { name: 'nExtPoint7', type: 'string' },

                ],
             
                id: 'cAccName',
                url: url
            };
          
            var dataAdapter = new $.jqx.dataAdapter(source, {
                downloadComplete: function (data, status, xhr) { },
                loadComplete: function (data) { },
                loadError: function (xhr, status, error) { }
            });
            // initialize jqxGrid
            $("#jqxgrid").jqxGrid(
            {
                width: '100%',
                source: dataAdapter,
                pageable: true,
                autoheight: true,
                sortable: true,
                altrows: true,
                enabletooltips: true,
                showfilterrow: true,
                filterable:true,
                editable: false,
                selectionmode: 'multiplecellsadvanced',
                columns: [
                    {
                        text: 'Chi tiết', datafield: 'View', columntype: 'button', width: 100, cellsrenderer: function () {
                            return "View";
                        }, buttonclick: function (editrow) {

                            var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
                            window.location = "@Url.Action("Search")/?search=" + dataRecord.cAccName;


                        }
                    },
                  { text: 'Tài khoản', datafield: 'cAccName', width: 100 },
                     { text: 'dLoginDate', datafield: 'dLoginDate',cellsformat:"dd-MM-yyyy hh:mm:ss",  width: 200 },
                    { text: 'dLogoutDate', datafield: 'dLogoutDate', cellsformat: "dd-MM-yyyy hh:mm:ss", width: 200 },
                   //dLogoutDate
                   { text: 'nExtPoint', datafield: 'nExtPoint', width: 100 },
                   { text: 'nExtPoint1', datafield: 'nExtPoint1', width: 100 },
                    { text: 'nExtPoint2', datafield: 'nExtPoint2', width: 100 },
                     { text: 'nExtPoint3', datafield: 'nExtPoint3', width: 100 },
                      { text: 'nExtPoint4', datafield: 'nExtPoint4', width: 100 },
                       { text: 'nExtPoint5', datafield: 'nExtPoint5', width: 100 },
                        { text: 'nExtPoint6', datafield: 'nExtPoint6', width: 100 },
                         { text: 'nExtPoint7', datafield: 'nExtPoint7', width: 100 }

                ]
            });
        });
    </script>
<form action="@Url.Action("Search")" method="get">

    <p>Tìn kiếm tài khoản:
        <input type="search" name="search" />
        <input type="submit" /></p>


</form>
<h3>100 Account xếp theo số KNB cao nhât</h3>
<div id="jqxgrid" style="margin-left: 4px; margin-top: 10px; margin-bottom: 10px;"></div>

<!-- end showcontent-->


<!---->
